package com.pktechan.api.sendMiniMessage;

import com.alibaba.fastjson.JSONObject;
import com.pktechan.api.activeMq.ActiveMQSendService;
import com.pktechan.api.sendMiniMessage.bean.BaseMiniMessage;
import com.pktechan.api.sendMiniMessage.enumration.SendMiniMessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: gsPrivateSale19
 * @description: 推荐人接收-客户-完成手机号注册-绑定成功通知
 * @author: qx.zhang
 * @create: 2020-06-01 16:55
 */
@Component("customerBindingSuccessStrategy")
public class CustomerBindingSuccessStrategy extends BaseSendMiniMessage implements SendMiniMessageStrategy {

    private static final Logger logger = LoggerFactory.getLogger(CustomerBindingSuccessStrategy.class);

    @Autowired
    private ActiveMQSendService activeMQSendService;

    /**
     * 获取发送消息对象对应的枚举
     *
     * @return
     */
    @Override
    public SendMiniMessageEnum getMappingEnum() {
        return SendMiniMessageEnum.CUSTOMER_BINDING_SUCCESS;
    }

    /**
     * 发送微信通知消息请求到中，
     *
     * @param baseMiniMessage
     */
    @Override
    public void sendMiniMessageToActiveMq(BaseMiniMessage baseMiniMessage) {
        baseMiniMessage.setMessageType(SendMiniMessageEnum.CUSTOMER_BINDING_SUCCESS.getId());
        logger.debug("（20240604后，不发送MQ）发送推荐人接收-客户-完成手机号注册-绑定成功通知消息到MQ中" + JSONObject.toJSONString(baseMiniMessage));
        activeMQSendService.sendMiniMessageQueue(JSONObject.toJSONString(baseMiniMessage));
    }
}
